﻿<Window x:Class="Pomodairo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Pomodairo="clr-namespace:Pomodairo"
        Title="MainWindow" ResizeMode="CanMinimize" Topmost="True" WindowStyle="None" Background="#FF4B4444" BorderBrush="{x:Null}" MouseLeftButtonDown="Window_MouseLeftButtonDown" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="500" d:DesignWidth="330" SizeToContent="Height" Width="320" Height="540" Icon="/Pomodairo;component/icon/Pomodairo.ico" AllowsTransparency="True" Opacity="0.8">

    <Window.Resources>

        <Pomodairo:TaskForegroundConverter x:Key="TaskForegroundConverter"/>
        <Pomodairo:TaskClassConverter x:Key="TaskClassConverter" />
        <Pomodairo:TaskToolTipConverter x:Key="TaskToolTipConverter" />
        <Pomodairo:TaskCompleteConverter x:Key="TaskCompleteConverter" />

        <Style x:Key="Digital7Font">
            <Setter Property="TextElement.FontFamily" Value="font/#Digital-7 Mono"/>
        </Style>

        <Style x:Key="ButtonStyle" TargetType="Button">
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border x:Name="CustomButton" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="true">
                                <Setter Property="Background" TargetName="CustomButton">
                                    <Setter.Value>
                                        <SolidColorBrush Color="#FF99B4D1"></SolidColorBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>

                </Setter.Value>
            </Setter>
        </Style>        
    </Window.Resources>

    <Grid Name="MainGrid" Margin="0,0,0,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="22" />
            <RowDefinition Height="100" />
            <RowDefinition Height="50" />
            <RowDefinition Height="367"/>
        </Grid.RowDefinitions>
        <ToolBarPanel Grid.Row="0" Height="22" HorizontalAlignment="Stretch" Name="TaskMenuBar" VerticalAlignment="Stretch" Width="320" Orientation="Horizontal">
            <Menu Height="22" Name="SystemMenu" Width="40" Background="#FF4B4444" Foreground="White">
                <MenuItem Header="设置" Background="#FF4B4444" Height="22" Width="40" Padding="7,4,8,3" BorderThickness="0">
                    <MenuItem Header="统计" Background="#FF4B4444"/>
                    <MenuItem Header="配置" Background="#FF4B4444"/>
                    <MenuItem Header="同步" Background="#FF4B4444"/>
                </MenuItem>
            </Menu>
            <Label AllowDrop="False" Width="188" />
            <Button Content="查看" Height="22" Name="btnView" Foreground="White" Background="#FF4B4444" HorizontalAlignment="Stretch" Width="40" Click="btnView_Click" Style="{StaticResource ButtonStyle}"/>
            <Button Content="_" Height="22" Name="btnMin" Width="22" Foreground="White" Background="#FF4B4444" Click="btnMin_Click" Style="{StaticResource ButtonStyle}"/>
            <Button Content="x" Height="22" Name="btnQuit" Width="22" Foreground="White" Background="#FF4B4444" Click="btnQuit_Click" Style="{StaticResource ButtonStyle}"/>
        </ToolBarPanel>

        <Rectangle Fill="#FF99B4D1" Height="1" Grid.Row="1" VerticalAlignment="Top"/>
        <Label Content="25:00" Grid.Row="1" Style="{DynamicResource Digital7Font}" HorizontalAlignment="Left" Margin="10,0,20,0" Name="LabelTimer" VerticalAlignment="Top" FontSize="80" Foreground="Yellow" FontStretch="Normal" Padding="0" FontWeight="Normal" />
        <Button Content="开始" Grid.Row="1" Height="40" HorizontalAlignment="Stretch" Margin="223,12,9,48" Name="btnStartTask" VerticalAlignment="Stretch" Width="76" Foreground="White" Background="#FF4B4444" Click="btnStartTask_Click" />
        <Label Content="选择任务" Grid.Row="1" HorizontalAlignment="Left" Margin="12,0,0,0" Name="LabelTask" Foreground="White" VerticalAlignment="Bottom"/>
        <Button Content="下一个" Grid.Row="1" Height="23" HorizontalAlignment="Stretch" Margin="223,70,9,6" Name="btnNext" VerticalAlignment="Stretch" Width="76" Foreground="White" Background="#FF4B4444"/>

        <Rectangle Fill="#FF99B4D1" Height="1" Grid.Row="2" VerticalAlignment="Top"/>
        <ToolBarPanel Grid.Row="2" Margin="0,0" Name="TaskControlBar" Orientation="Horizontal" HorizontalAlignment="Stretch">
            <Button Content="任务列表" Height="23" Name="btnTaskList" Width="90" Margin="15,0,0,0" Foreground="White" Background="#FF4B4444" Click="btnTaskList_Click" />
            <Button Content="未计划" Height="23" Name="btnUnplan" Width="90" Margin="15,0,0,0" Foreground="White" Background="#FF4B4444" Click="btnUnplan_Click"/>
            <Button Content="中断" Height="23" Name="btnInterruption" Width="90" Margin="15,0,0,0" Foreground="White" Background="#FF4B4444" Click="btnInterruption_Click" />
        </ToolBarPanel>
        <Grid Grid.Row="3" Name="TaskListGrid" Margin="0,0,0,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="337"/>
                <RowDefinition Height="30" />
            </Grid.RowDefinitions>
            <DataGrid AutoGenerateColumns="False" CanUserResizeRows="False" CanUserSortColumns="False" Grid.Row="0" Margin="0,0,0,0" Name="TaskGrid" IsReadOnly="True" ItemsSource="{Binding}" GridLinesVisibility="None" Foreground="#FF574F4F" SelectionChanged="TaskGrid_SelectionChanged" SelectionMode="Extended">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="ID" Binding="{Binding TaskOneNoteId}" Visibility="Collapsed"/>
                    <DataGridTextColumn Header="任务名称" MinWidth="220" Binding="{Binding TaskName}">
                    </DataGridTextColumn>
                    <DataGridTextColumn Header="E" MinWidth="20" Binding="{Binding TaskTimeEdit}"/>
                    <DataGridTextColumn Header="P" MinWidth="20" Binding="{Binding TaskTimeUsage}"/>
                    <DataGridTextColumn Header="U" MinWidth="20" Binding="{Binding TaskTimeUnPlan}"/>
                    <DataGridTextColumn Header="I" MinWidth="20" Binding="{Binding TaskTimeInterrupt}"/>
                </DataGrid.Columns>                
                <DataGrid.RowHeaderStyle>
                    <Style TargetType="DataGridRowHeader">                       
                        <Setter Property="Width" Value="8"/>
                        <Setter Property="Background" Value="{Binding RelativeSource={RelativeSource Self},Path=DataContext, Converter={StaticResource TaskClassConverter}}" />                        
                    </Style>
                </DataGrid.RowHeaderStyle>
                <DataGrid.RowStyle>
                    <Style TargetType="DataGridRow">
                        <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource Self},Path=DataContext, Converter={StaticResource TaskForegroundConverter}}" />
                        <Setter Property="Background"  Value="{Binding RelativeSource={RelativeSource Self},Path=DataContext, Converter={StaticResource TaskCompleteConverter}}" />
                        <Style.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self},Path=DataContext, Converter={StaticResource TaskToolTipConverter}}"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </DataGrid.RowStyle>
                <!--<DataGrid.CellStyle>
                    <Style TargetType="DataGridCell">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="DataGridCell">
                                    <TextBlock TextDecorations="Strikethrough" >
                                        <ContentPresenter />
                                    </TextBlock>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </DataGrid.CellStyle>-->
            </DataGrid>
            <Button Content="同步" Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="234,3,0,0" Name="btnSynch" VerticalAlignment="Top" Width="75" Foreground="White" Background="#FF4B4444" Click="btnSynch_Click"/>
        </Grid>

    </Grid>
</Window>
